package dsf.eshop.commons.utils;

import java.util.Date;
import java.util.Random;

public class RandomUtil {

    private static final String source = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

    public static String randomString(int length) {

        StringBuilder stringBuffer = new StringBuilder(length);

        Random random = new Random(new Date().getTime());

        for (int i = 0; i < length; i++) {
            stringBuffer.append(source.charAt(random.nextInt(62)));
        }

        return stringBuffer.toString();
    }
}
